﻿using System;
using Granite.ComponentModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Granite.Commons.Tests.ComponentModel
{
    [TestClass()]
    public class DictionaryChangedEventArgsTests
    {

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor4_Test1()
        {
            try
            {
                var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Add, 1, 2, 3);
                Assert.Fail("Expected an ArgumentOutOfRangeException");
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Assert.AreEqual("action", ex.ParamName, "Incorrect parameter name");
                Assert.AreEqual(NotifyDictionaryChangedAction.Add, ex.ActualValue, "ActualValue was not set");
            }
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor4_Test2()
        {
            try
            {
                var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Remove, 1, 2, 3);
                Assert.Fail("Expected an ArgumentOutOfRangeException");
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Assert.AreEqual("action", ex.ParamName, "Incorrect parameter name");
                Assert.AreEqual(NotifyDictionaryChangedAction.Remove, ex.ActualValue, "ActualValue was not set");
            }
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor4_Test3()
        {
            var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Replace, 1, 2, 3);
            Assert.AreEqual(NotifyDictionaryChangedAction.Replace, result.Action, "Action was not set");
            Assert.AreEqual(1, result.Key, "Key was not set");
            Assert.AreEqual(2, result.OldValue, "OldValue was not set");
            Assert.AreEqual(3, result.NewValue, "NewValue was not set");
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor4_Test4()
        {
            try
            {
                var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Reset, 1, 2, 3);
                Assert.Fail("Expected an ArgumentOutOfRangeException");
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Assert.AreEqual("action", ex.ParamName, "Incorrect parameter name");
                Assert.AreEqual(NotifyDictionaryChangedAction.Reset, ex.ActualValue, "ActualValue was not set");
            }
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor3_Test1()
        {
            var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Add, 1, 2);
            Assert.AreEqual(NotifyDictionaryChangedAction.Add, result.Action, "Action was not set");
            Assert.AreEqual(1, result.Key, "Key was not set");
            Assert.IsNull(result.OldValue, "OldValue should be null");
            Assert.AreEqual(2, result.NewValue, "NewValue was not set");
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor3_Test2()
        {
            var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Remove, 1, 2);
            Assert.AreEqual(NotifyDictionaryChangedAction.Remove, result.Action, "Action was not set");
            Assert.AreEqual(1, result.Key, "Key was not set");
            Assert.AreEqual(2, result.OldValue, "OldValue was not set");
            Assert.IsNull(result.NewValue, "NewValue should be null");
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor3_Test3()
        {
            try
            {
                var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Replace, 1, 2);
                Assert.Fail("Expected an ArgumentOutOfRangeException");
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Assert.AreEqual("action", ex.ParamName, "Incorrect parameter name");
                Assert.AreEqual(NotifyDictionaryChangedAction.Replace, ex.ActualValue, "ActualValue was not set");
            }
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor3_Test4()
        {
            try
            {
                var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Reset, 1, 2);
                Assert.Fail("Expected an ArgumentOutOfRangeException");
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Assert.AreEqual("action", ex.ParamName, "Incorrect parameter name");
                Assert.AreEqual(NotifyDictionaryChangedAction.Reset, ex.ActualValue, "ActualValue was not set");
            }
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor1_Test1()
        {
            try
            {
                var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Add);
                Assert.Fail("Expected an ArgumentOutOfRangeException");
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Assert.AreEqual("action", ex.ParamName, "Incorrect parameter name");
                Assert.AreEqual(NotifyDictionaryChangedAction.Add, ex.ActualValue, "ActualValue was not set");
            }
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor1_Test2()
        {
            try
            {
                var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Remove);
                Assert.Fail("Expected an ArgumentOutOfRangeException");
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Assert.AreEqual("action", ex.ParamName, "Incorrect parameter name");
                Assert.AreEqual(NotifyDictionaryChangedAction.Remove, ex.ActualValue, "ActualValue was not set");
            }
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor1_Test3()
        {
            try
            {
                var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Replace);
                Assert.Fail("Expected an ArgumentOutOfRangeException");
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Assert.AreEqual("action", ex.ParamName, "Incorrect parameter name");
                Assert.AreEqual(NotifyDictionaryChangedAction.Replace, ex.ActualValue, "ActualValue was not set");

            }
        }

        [TestMethod()]
        public void DictionaryChangedEventArgsConstructor1_Test4()
        {
            var result = new DictionaryChangedEventArgs(NotifyDictionaryChangedAction.Reset);
            Assert.AreEqual(NotifyDictionaryChangedAction.Reset, result.Action, "Action was not set");
            Assert.IsNull(result.Key, "Key should be null");
            Assert.IsNull(result.OldValue, "OldValue should be null");
            Assert.IsNull(result.NewValue, "NewValue should be null");
        }

    }
}
